package com.fqgj.xjd.user.client.enums;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: sm
 * Date: 2017/3/1
 * Time: 上午10:57
 */
public enum UserEducationEnum {
    BELOW_HIGH_SCHOOL(1, "Below High School"),
    HIGH_SCHOOL(2, "High School"),
    BACHELOR(3, "Bachelor"),
    MASTER(4, "Master"),
    DOCTOR(5, "Doctor");
    private Integer type;
    private String desc;

    UserEducationEnum(Integer type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public Integer getType() {
        return type;
    }

    public UserEducationEnum setType(Integer type) {
        this.type = type;
        return this;
    }

    public String getDesc() {
        return desc;
    }

    public UserEducationEnum setDesc(String desc) {
        this.desc = desc;
        return this;
    }

    public static List<String> userEducationEnumList() {
        List<String> list = new ArrayList<>();
        for (UserEducationEnum enumObj : UserEducationEnum.values()) {
            list.add(enumObj.getDesc());
        }
        return list;
    }

    public static List<String> getDescList() {
        List<String> list = new ArrayList<>();
        for (UserEducationEnum enumObj : UserEducationEnum.values()) {
            list.add(enumObj.getDesc());
        }
        return list;
    }

    public static UserEducationEnum getEnumByType(Integer type) {
        UserEducationEnum userEducationEnum = null;
        for (UserEducationEnum enumObj : UserEducationEnum.values()) {
            if (enumObj.getType().equals(type)) {
                userEducationEnum = enumObj;
                break;
            }
        }
        return userEducationEnum;
    }
    
    public static UserEducationEnum getEnumByDesc(String desc) {
        UserEducationEnum userEducationEnum = null;
        for (UserEducationEnum enumObj : UserEducationEnum.values()) {
            if (enumObj.getDesc().equals(desc)) {
                userEducationEnum = enumObj;
                break;
            }
        }
        return userEducationEnum;
    }
}
